package chances.wechat.api;

import org.springframework.aop.framework.ProxyFactory;
import org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor;

public class TokenResovlerImpl extends HttpInvokerClientInterceptor implements TokenResovler {
	
	private TokenResovler tokenResovler;
	
	public TokenResovlerImpl(String url) {
		this.setServiceUrl(url);
		this.tokenResovler = (TokenResovler) new ProxyFactory(TokenResovler.class, this).getProxy(getBeanClassLoader());
	}

	@Override
	public String getToken(String appId, String secret) {
		return this.tokenResovler.getToken(appId, secret);
	}

	@Override
	public String getJSToken(String accessToken) {
		return this.tokenResovler.getJSToken(accessToken);
	}

	public TokenResovler getTokenResovler() {
		return tokenResovler;
	}

	public void setTokenResovler(TokenResovler tokenResovler) {
		this.tokenResovler = tokenResovler;
	}

}
